package ldkxingzhe.ldkxingzhedemo.service;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;

import ldkxingzhe.ldkxingzhedemo.utils.LogDemo;

/**
 * Created by liangdengke on 2015/9/11.
 */
public class StockQuoteService extends Service{

    private final String TAG = StockQuoteService.class.getSimpleName();


    public class StockQuoteImpl extends IStockQuoteService.Stub{

        @Override
        public double getQuote(String ticker) throws RemoteException {

            LogDemo.v(TAG,"getQuote(" + ticker + ")");
            return 100;
        }

        @Override
        public double setPerson(String ticker, Person person) throws RemoteException {
            LogDemo.v(TAG,"gerPerson");
            LogDemo.v(TAG,"person.name = " + person.getName() + ",person.age = " + person.getAge());
            return 0;
        }
    }

    @Override
    public void onCreate() {
        super.onCreate();
        LogDemo.v(TAG,"onCreate");
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        LogDemo.v(TAG,"onDestroy");
    }

    @Override
    public IBinder onBind(Intent intent) {
        LogDemo.v(TAG,"onBind");
        return new StockQuoteImpl();
    }
}
